Skip to content

Fix normalize_paths to allow whitespace#343

Merged
IanLee1521 merged 1 commit intoPyCQA:masterfrom
willkg:normalize_path_fix
Dec 13, 2014
Merged

Fix normalize_paths to allow whitespace#343
IanLee1521 merged 1 commit intoPyCQA:masterfrom
willkg:normalize_path_fix

Conversation

@willkg
Copy link
Copy Markdown
Contributor

@willkg willkg commented Nov 7, 2014

This fixes normalize_paths so that it strips whitespace before and after
paths before working on them. This allows you to do specify excludes
with multiple lines in the config file.

This also tweaks normalize_paths so that the behavior matches the
docstring.

This also adds tests.

Fixes #339

This fixes normalize_paths so that it strips whitespace before and after
paths before working on them. This allows you to do specify excludes
with multiple lines in the config file.

This also tweaks normalize_paths so that the behavior matches the
docstring.

This also adds tests.

Fixes #339
Comment thread pep8.py
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I split this up because if not value could be any falsey value and the docstring states that this function returns a list, thus it should return an empty list in these cases.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @willkg, I'd be interested to hear what your case was where this was failing for you. I'm tempted to update this to the following to handle the case where it isn't a list or a string coming in. Alternatively, perhaps it would be better to raise a ValueError at that point.

if not value:
    return []
if isinstance(value, list):
    return value
if not isinstance(value, str):
    return []

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a preference one way or the other. I changed this code because the docstring says it returns a list, but the code was just returning falsey values. I don't have a preference for my version or your version or even changing it to raise a ValueError.

@sigmavirus24
Copy link
Copy Markdown
Member

Wouldn't most of your inline review comments be better as ... comments in the code?

@willkg
Copy link
Copy Markdown
Contributor Author

willkg commented Nov 7, 2014

I didn't think so, which is why I did what I did.

If someone wants me to move those reviewer comments into the code, I can. I wouldn't do that for my projects, but I'll do whatever to get this landed because long or non-trivial exclude configuration is very difficult to read and maintain right now.

@sigmavirus24
Copy link
Copy Markdown
Member

You're justifying your decisions for the code. Those belong as comments (unless you never document any code you write). That said, you might notice I don't have the fancy "contributor" label on my comments so appeasing me won't get your code merged, especially since the maintainer is not actively maintaining this right now.

@willkg
Copy link
Copy Markdown
Contributor Author

willkg commented Nov 7, 2014

Generally, I agree with you regarding comments. Looking at these specific review comments, I don't think they belong in the code and don't think they help much. It's possible I don't understand what you're suggesting here since you've been pretty general so far.

Can you go through the review comments I wrote up and translate them into code comments you think are appropriate here?

@IanLee1521 IanLee1521 merged commit 78d959d into PyCQA:master Dec 13, 2014
IanLee1521 added a commit that referenced this pull request Dec 13, 2014
IanLee1521 added a commit that referenced this pull request Dec 13, 2014
@myint
Copy link
Copy Markdown
Member

myint commented Dec 13, 2014

@IanLee1521, are you the new maintainer? I haven't seen you on here before.

@IanLee1521
Copy link
Copy Markdown
Member

Hi @myint, yes, I just started working today on finally getting some of these issues and pull requests resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

multiple line comma-separated values in INIs handled incorrectly

4 participants